import pygame,os,sys

HEIGHT = 640
WIDTH = 480
BACKGROUND = (255,255,255)

class Game(object):
	def __init__(self):
		paused = False
		pygame.init() 
		window = pygame.display.set_mode((HEIGHT, WIDTH)) 
		pygame.display.set_caption('AP Testing') 
		screen = pygame.display.get_surface()
		screen.fill(BACKGROUND)
		apFN = os.path.join("","ap.png")
		apSurface = pygame.image.load(apFN)
		screen.blit(apSurface, ((HEIGHT/2)-(apSurface.get_height()/2),(WIDTH/2)-(apSurface.get_width()/2)))		
		pygame.display.flip()
		self.delta = 10
		self.nSize = 0
		pygame.mixer.init()
		apSound = pygame.mixer.Sound("../src/data/sfx/beep0.wav")
		apSound.set_volume(0.2)
		apSound.play()
		backSound = pygame.mixer.Sound("../src/data/music/funky.wav")
		backSound.set_volume(0.5)
		backChannel = backSound.play(-1)
		
		while (True):
			for event in pygame.event.get():
				if (event.type == pygame.QUIT):
					sys.exit()
				elif (event.type == pygame.KEYDOWN):
					paused = not paused
			
			if (not paused): 
				backChannel.unpause()
				screen.fill(BACKGROUND)
				screen.blit(apSurface, ((HEIGHT/2)-(apSurface.get_height()/2), (WIDTH/2)-(apSurface.get_width()/2)))
				pygame.draw.circle(screen, (0, 127, 255), ((HEIGHT/2), (WIDTH/2)), self.nSize+1, 1)
				self.nSize += 10
				self.nSize %= 200
				if (not self.nSize):
					apSound.play()
				pygame.display.flip()
				pygame.time.delay(30)
			
			if (paused):
				backChannel.pause()
	
	def input(events): 
		for event in events: 
			if event.type == QUIT: 
				sys.exit(0) 
			else:
				print event

if __name__ == "__main__":
	game = Game()
